#ifndef MUTATENDRIL_H
#define MUTATENDRIL_H

#include <QGraphicsPathItem>
#include "MutaObject.h"
#include "ControlPoint.h"

class MutaTendril : public MutaObject, public QGraphicsPathItem
{
    Q_OBJECT
public:
    MutaTendril(QString owner,QPointF p1,QPointF p2,int layer);
    virtual void setPos(const QPointF &pos);

    void setFinalPoint(QPointF p);
    void addControlPoint(QPointF p);
    void setPoint(int num, QPointF p);
    int getLayer();
    QStringList getProperties();
    int type() const;
    enum TendrilMode{Quantized, Free, Melding};
protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

private:
    TendrilMode mode;
    int numTendrils;
    float deviance;
    QVector< QList<ControlPoint*>* > controlPoints;
    //QList<ControlPoint*> curvePoints;
    void buildPath();
    void setColor();
    int time;
    QColor boxColor;
    QBrush boxBrush;
    QPen boxPen;
    int layer;
signals:
    void ellipseAdded(QGraphicsItem* ellipse);

public slots:
    void cPointMoved(QPointF pos,int num);
};

#endif // MUTATENDRIL_H
